package com.zaixiandiancan.xia.serviceImpl;

import com.zaixiandiancan.xia.dao.OrderDao;
import com.zaixiandiancan.xia.entity.Order;
import com.zaixiandiancan.xia.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service("orderService")
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderDao orderDao;

    @Override
    @Transactional
    public boolean addOrder(List<Order> order) {
        try {
            return orderDao.addOrder(order);
        }catch (Exception e){
            System.out.println(e.getMessage());
            return false;
        }
    }

    @Override
    public List<Map> searchOrder(Order order) {
        try {
            return orderDao.searchOrders(order);
        }catch (Exception e){
            System.out.println(e.getMessage());
            return null;
        }
    }
}
